package com.taxshare.operation.controller;

import com.taxshare.operation.view.vo.MessageTemplateVO;
import com.taxshare.operation.view.vo.MessageUsersStateVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.operation.service.MessageInfoService;
import com.taxshare.operation.view.vo.MessageInfoVO;
import com.taxshare.response.beans.Response;

import java.util.HashMap;
import java.util.List;

/**
    * @ClassName: MessageInfoController
    * @Description: (消息信息)
    * @author liupp
    * @date 2021年1月26日
    *
 */
@RestController
@RequestMapping(value = "/message/info")
@Api(tags = "消息信息")
public class MessageInfoController{

    @Autowired
    private MessageInfoService messageInfoService;

    @RequestMapping(method = RequestMethod.POST, value = "/queryPageList")
    @ApiOperation(notes = "消息信息【分页】", value = "消息信息【分页】")
    public Response<IPage<MessageInfoVO>> getTemplateList(@RequestBody PageRequest<MessageInfoVO> query) {
        return messageInfoService.queryPageList(query);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/add")
    @ApiOperation(notes = "消息信息", value = "新增")
    public Response add(@RequestBody MessageInfoVO messageInfoVO) {
        return messageInfoService.addTemplate(messageInfoVO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/edit")
    @ApiOperation(notes = "消息信息", value = "修改状态")
    public Response edit(@RequestBody MessageInfoVO messageInfoVO) {
        return messageInfoService.updateTemplate(messageInfoVO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/delete")
    @ApiOperation(notes = "消息信息", value = "删除")
    public Response delete(@ApiParam(value = "唯一标识集合", required = true)@RequestParam String uuid) {
        return messageInfoService.deleteTemplate(uuid);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/insertDisplay")
    @ApiOperation(notes = "已读消息信息存表", value = "已读消息信息存表")
    public void insertDisplayMessageWarning( @RequestBody MessageInfoVO messageInfoVO) {
        messageInfoService.insertDisplayMessageWarning(messageInfoVO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/queryRead")
    @ApiOperation(notes = "消息（已读、未读）内容及用户查询", value = "消息（已读、未读）内容及用户查询")
    public Response<HashMap<String, Object>> queryReadMessageWarning(MessageInfoVO messageInfoVO) {
        return messageInfoService.queryReadMessageWarning(messageInfoVO);
    }

}
